export const LocationStore = {
  state:{
    location:{},
    address:'定位中...'
  },
  getters: {
    location: state => state.location,
    address: state => state.address
  },
  mutations:{
    setLocation(state, location){
      if(location){
        state.location = location;
      }else{
        state.location = {};
      }
    },
    setAddress(state, location){
      if(location){
        state.address = location;
      }else{
        state.address = "定位中...";
      }
    }
  },
  actions:{
    setLocation({ commit }, location) {
      commit("setLocation", location);
    },
    setAddress({ commit }, address) {
      commit("setAddress", address);
    }
  }
}